#include<iostream>
#include<vector>
#include<string>
using namespace std;


class Solution {
public:
    vector<int>mul(vector<int>& A, vector<int>& B)
    {
        vector<int> C(A.size() + B.size(), 0);

        for (int i = 0; i < A.size(); i++)
            for (int j = 0; j < B.size(); j++)
            {
                C[i + j] += A[i] * B[j];
            }
        int t = 0;
        for (int i = 0; i < C.size(); i++)
        {
            t += C[i];
            C[i] = t % 10;
            t /= 10;
        }

        while (C.size() > 1 && C.back() == 0) C.pop_back();
        return C;

    }
    string multiply(string num1, string num2)
    {
        //nums1="123"
        vector<int> A, B;
        for (int i = num1.size() - 1; i >= 0; i--) A.push_back(num1[i] - '0');
        //A={3,2,1}
        for (int i = num2.size() - 1; i >= 0; i--) B.push_back(num2[i] - '0');

        auto C = mul(A, B);

        string res = "";
        for (int i = C.size() - 1; i >= 0; i--)
            res += to_string(C[i]);

        return res;
    }
};